<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{
        $this->load->library('session');

        $data['window'] = 'home';
        $data['pagetitle'] = 'Home';
        $this->load_header($data);

        $this->load->view('home', $data);

        $this->load_footer();
	}

    public function load_search_page()
    {
        $this->load->library('session');

        $data['window'] = 'search';
        $data['pagetitle'] = 'Search Rooms';
        $this->load_header($data);

        $this->load->view('rezervare');

        $this->load_footer();
    }

    public function load_contact_page()
    {
        $this->load->library('session');

        $data['window'] = 'contact';
        $data['pagetitle'] = 'Contact Us';
        $this->load_header($data);

        $this->load->view('contact', $data);

        $this->load_footer();
    }

    public function load_register_page()
    {
        $this->load->library('session');

        $data['window'] = 'home';
        $data['pagetitle'] = 'Register';
        $this->load_header($data);

        $this->load->view('register');

        $this->load_footer();
    }

    public function load_rezervations_page()
    {
        $this->load->library('session');

        $data['result'] = array();

        if($this->session->userdata('logged') == 1)
        {
            $data['window'] = 'rezervation';
            $data['pagetitle'] = 'Rezervations';
            $this->load_header($data);

            $this->load->model('db_model_find');

            $data['result'] = $this->db_model_find->find_user_specific($this->session->userdata('id'));

            $this->load->view('rezervations', $data);

            $this->load_footer();
        }
        else
        {
            $data['window'] = 'home';
            $data['pagetitle'] = 'Login';
            $this->load_header($data);

            $this->load->view('login');

            $this->load_footer();
        }
    }

    private function load_header($data)
    {
        $this->load->view('header', $data);
    }

    private function load_footer()
    {
        $this->load->view('footer');
    }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */